package wj.d822;

import java.util.Scanner;
import java.util.Stack;

//括号
public class Parentheses {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String params = scanner.nextLine();
        //0. 输入为空或仅有一个符号

        if (params == null || params.length() < 2) {
            System.out.println(0);
        } else {
            Stack<Object> stack = new Stack<>();
            char[] chars = params.toCharArray();
            int paramsIdx = 0; //输入串索引
            while (paramsIdx < chars.length) {
                char curFlag = chars[paramsIdx];
                if (curFlag == '(') { //左括号直接入栈
                    stack.push(curFlag);
                } else if (curFlag == ')') { // 右括号则从栈中弹出一个进行比较
                    if (stack.isEmpty()) {// 表达式不正确
                        System.out.println(0);
                    }
                    Object pop = stack.pop();
                    if (pop instanceof Character) {// 左括号
                        long tmp = 2;
                        if (!stack.isEmpty() && stack.peek() instanceof Long) {
                            tmp = (Long) stack.pop() * 2;
                        }
                        stack.push(tmp);
                    } else if (pop instanceof Long) {// 数字
                        long tmp = (Long) pop + 1;
                        stack.pop();    // 弹出左括号
                        if (!stack.isEmpty() && stack.peek() instanceof Long) {
                            tmp = (Long) stack.pop() * tmp;
                        }
                        stack.push(tmp);
                    }
                }
                paramsIdx++;
            }
            System.out.println((Long) stack.pop() % 1000000007);
        }
    }
}
